|
|
|
|
|
|
|
Answer to Day 18 Exercise |
|
|
|
|
|
|
|
|
To complete this assignment, you need to create a data form that has two buttons, and a list box. You use RDO for this project, so be sure to add the RDO library from the Project | Components menu. |
|
|
|
|
|
|
|
|
1. Start a new Visual Basic 5 Standard EXE project. |
|
|
|
|
|
|
|
|
2. Add two command buttons (cmdTables and cmdClear) and a list box (List1) to the form. |
|
|
|
|
|
|
|
|
3. Add the following code to the form (this is all the code you need). |
|
|
|
|
|
|
|
|
Private Sub cmdTables_Click()
'
' get rdo table collection
'
On Error GoTo LocalErr
'
Dim rdoEnv As rdoEnvironment
Dim rdoCon As rdoConnection
Dim rdoTbl As rdoTable
'
' set env/con
Set rdoEnv = rdoEngine.rdoCreateEnvironment("rdoTEMP", "admin", "")
Set rdoCon = rdoEnv.OpenConnection("")
'
' update the tables collection
rdoCon.rdoTables.Refresh
'
' show table properties
List1.Clear
For Each rdoTbl In rdoCon.rdoTables
List1.List(List1.ListIndex) = rdoTbl.Name & " [" & rdoTbl.Type
& "]"
Next
'
rdoCon.Close
rdoEnv.Close
Set rdoTbl = Nothing
Set rdoCon = Nothing
Set rdoEnv = Nothing
'
Exit Sub
'
LocalErr:
MsgBox Err.Description, vbExclamation, "RDOTables"
'
End Sub
Private Sub cmdClear_Click()
List1.Clear
End Sub
Private Sub Form_Load()
' |
|
|
|
|
|